import { request } from "@/utils/service"
import type * as Course from "./types/course"

/** 增 */
export function createCourseDataApi(data: Course.CreateOrUpdateCourseRequestData) {
  return request({
    url: "course",
    method: "post",
    data
  })
}

/** 删 */
export function deleteCourseDataApi(ids: string) {
  return request({
    url: `course/batch?ids=${ids}`,
    method: "delete"
  })
}

// /** 改 */
export function updateCourseDataApi(data: Course.CreateOrUpdateCourseRequestData) {
  return request({
    url: "course",
    method: "put",
    data
  })
}

/** 查 */
export function getCourseDataApi(params: Course.GetCourseRequestData) {
  return request<Course.GetCourseResponseData>({
    url: "course",
    method: "get",
    params
  })
}

/** 查 */
export function getTypeListApi() {
  return request<Course.GetTypeResponseData>({
    url: "type/list",
    method: "get"
  })
}

/** 下拉 */
export function getCourseListDataApi() {
  return request<Course.GetCourseListResponseData>({
    url: "course/list",
    method: "get"
  })
}
